package com.gpx2shp;

import android.util.Log;

import com.astrob.NavFrameSDK;

/**
 * Created by jack on 07/08/2018.
 */

public class JniUtils {

    public static JniUtils getInstance() {
        return instance;
    }

    private static JniUtils instance = new JniUtils();

    public JniUtils(){

    }

    static {
        System.loadLibrary("proj");
        System.loadLibrary("expat");
        System.loadLibrary("gpx2shp");
        System.loadLibrary("jniutils");
    }

    public int receiveCMD(String command){
        if (command.isEmpty()) {
            return -6;
        }

        String args[] = command.split(" ");
        for (int i = 0; i < args.length; i++) {
            Log.d("gpx2shp-jni", args[i]);
        }
        int ret = -5;

        try {
            ret = startConvert(args.length, args);
        } catch (Exception e) {

        }

        return ret;
    }

    public native int startConvert(int argc, String[] args);
}
